$(document).ready(function (){

    var endPointOptions = {
        "url": "http://localhost:9200/GetEmployees",
        type: "GET",
        dataType: 'json',
        timeout: 10000,// load and performance testing LNP
        success: function(data,status,requestObj){

            //JsonString to javascript object
            //EmpData
         // var empData =     JSON.parse('{ "data" : {"employee" : { "name" : "madhu"}}');
            // javascript object to JsonString
           // empData.data.employee.name

          //  var stringEmpData =  JSON.stringify(empData);
            var employeeList = data.Data.EmployeeList;

            //JSON -- Douglas Crockford

            // data --> Array of objects
            var tableDataString = '';



            for(var i= 0 ; i < employeeList.length; i++){
                tableDataString  += '<tr><td>' + (i + 1) +'</td><td>'
                    + employeeList[i].name + '</td><td>'+ employeeList[i].title
                 + '</td><td>' + employeeList[i].city + '</td></tr>'
            }


            $('#employeeDetails tbody').append(tableDataString);


        },
        error: function(requestObj,status,error){

            alert('error happenned');
        },
        complete: function(requestObj,status){

        }
    };
    // this is the

    $.ajax(endPointOptions);
});
